from froModuleDrivers.gateway import GatewayDriver  # 引用网关驱动模块
from froModuleDrivers.nioManager import NioManager  # 引用驱动管理模块
import time

# 驱动初始化
driver_Infrared  = GatewayDriver("192.168.50.212", 4001)  # 实例化网关驱动
manager = NioManager(driver_Infrared)  # 实例化驱动管理模块，并把网关驱动加入管理
manager.run()  # 系统运行

# 红外对射传感器相关的API
# 获取当前红外对射模块的阻碍情况,有物体拦截返回True，没物体拦截返回False
print(driver_Infrared.getIRDegree(2))

# 等待指令执行完毕后系统退出
time.sleep(1)
manager.shutdownGracefully()